home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 July: Mac OS SDK / Dev.CD Jul 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Interfaces / PInterfaces / TranslationExtensions.p < prev    next >
Encoding:
Text File  |  1995-07-06  |  6.2 KB  |  200 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        TranslationExtensions.p
  3.  
  4.      Contains:    Macintosh Easy Open Translation Extension Interfaces.
  5.  
  6.      Version:    Technology:    Macintosh Easy Open 1.1
  7.                  Package:    Universal Interfaces 2.1 in “MPW Latest” on ETO #18
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. }
  19.  
  20. {$IFC UNDEFINED UsingIncludes}
  21. {$SETC UsingIncludes := 0}
  22. {$ENDC}
  23.  
  24. {$IFC NOT UsingIncludes}
  25.  UNIT TranslationExtensions;
  26.  INTERFACE
  27. {$ENDC}
  28.  
  29. {$IFC UNDEFINED __TRANSLATIONEXTENSIONS__}
  30. {$SETC __TRANSLATIONEXTENSIONS__ := 1}
  31.  
  32. {$I+}
  33. {$SETC TranslationExtensionsIncludes := UsingIncludes}
  34. {$SETC UsingIncludes := 1}
  35.  
  36.  
  37. {$IFC UNDEFINED __MEMORY__}
  38. {$I Memory.p}
  39. {$ENDC}
  40. {    Types.p                                                        }
  41. {        ConditionalMacros.p                                        }
  42. {    MixedMode.p                                                    }
  43.  
  44. {$IFC UNDEFINED __FILES__}
  45. {$I Files.p}
  46. {$ENDC}
  47. {    OSUtils.p                                                    }
  48. {    Finder.p                                                    }
  49.  
  50. {$IFC UNDEFINED __QUICKDRAW__}
  51. {$I Quickdraw.p}
  52. {$ENDC}
  53. {    QuickdrawText.p                                                }
  54.  
  55. {$IFC UNDEFINED __COMPONENTS__}
  56. {$I Components.p}
  57. {$ENDC}
  58.  
  59. {$PUSH}
  60. {$ALIGN MAC68K}
  61. {$LibExport+}
  62.  
  63. CONST
  64.     kSupportsFileTranslation    = 1;
  65.     kSupportsScrapTranslation    = 2;
  66.     kTranslatorCanGenerateFilename = 4;
  67.  
  68.     
  69. TYPE
  70.     FileType = OSType;
  71.  
  72.     ScrapType = ResType;
  73.  
  74.     TranslationAttributes = LONGINT;
  75.  
  76.  
  77. CONST
  78.     taDstDocNeedsResourceFork    = 1;
  79.     taDstIsAppTranslation        = 2;
  80.  
  81.  
  82. TYPE
  83.     FileTypeSpec = RECORD
  84.         format:                    FileType;
  85.         hint:                    LONGINT;
  86.         flags:                    TranslationAttributes;                    { taDstDocNeedsResourceFork, taDstIsAppTranslation}
  87.         catInfoType:            OSType;
  88.         catInfoCreator:            OSType;
  89.     END;
  90.  
  91.     FileTranslationList = RECORD
  92.         modDate:                LONGINT;
  93.         groupCount:                LONGINT;
  94.         {     unsigned long    group1SrcCount;}
  95.         {     unsigned long    group1SrcEntrySize = sizeof(FileTypeSpec);}
  96.         {  FileTypeSpec    group1SrcTypes[group1SrcCount]}
  97.         {  unsigned long    group1DstCount;}
  98.         {  unsigned long    group1DstEntrySize = sizeof(FileTypeSpec);}
  99.         {  FileTypeSpec    group1DstTypes[group1DstCount]}
  100.     END;
  101.  
  102.     FileTranslationListPtr = ^FileTranslationList;
  103.     FileTranslationListHandle = ^FileTranslationListPtr;
  104.  
  105.     ScrapTypeSpec = RECORD
  106.         format:                    ScrapType;
  107.         hint:                    LONGINT;
  108.     END;
  109.  
  110.     ScrapTranslationList = RECORD
  111.         modDate:                LONGINT;
  112.         groupCount:                LONGINT;
  113.         {     unsigned long        group1SrcCount;}
  114.         {     unsigned long        group1SrcEntrySize = sizeof(ScrapTypeSpec);}
  115.         {  ScrapTypeSpec        group1SrcTypes[group1SrcCount]}
  116.         {  unsigned long        group1DstCount;}
  117.         {     unsigned long        group1DstEntrySize = sizeof(ScrapTypeSpec);}
  118.         {  ScrapTypeSpec        group1DstTypes[group1DstCount]}
  119.     END;
  120.  
  121.     ScrapTranslationListPtr = ^ScrapTranslationList;
  122.     ScrapTranslationListHandle = ^ScrapTranslationListPtr;
  123.  
  124. { definition of callbacks to update progress dialog}
  125.     TranslationRefNum = LONGINT;
  126.  
  127. {****************************************************************************************
  128. *
  129. * This routine sets the advertisement in the top half of the progress dialog.
  130. * It is called once at the beginning of your DoTranslateFile routine.
  131. *
  132. * Enter:    refNum            Translation reference supplied to DoTranslateFile.
  133. *            advertisement    A handle to the picture to display.  This must be non-purgable.
  134. *                            Before returning from DoTranslateFile, you should dispose
  135. *                            of the memory.  (Normally, it is in the temp translation heap
  136. *                            so it is cleaned up for you.)
  137. *
  138. * Exit:    returns            noErr, paramErr, or memFullErr
  139. }
  140.  
  141. FUNCTION SetTranslationAdvertisement(refNum: TranslationRefNum; advertisement: PicHandle): OSErr;
  142.     {$IFC NOT GENERATINGCFM}
  143.     INLINE $7002, $ABFC;
  144.     {$ENDC}
  145. {****************************************************************************************
  146. *
  147. * This routine updates the progress bar in the progress dialog.
  148. * It is called repeatedly from within your DoTranslateFile routine.
  149. * It should be called often, so that the user will get feedback if he tries to cancel.
  150. *
  151. * Enter:    refNum        translation reference supplied to DoTranslateFile.
  152. *            progress    percent complete (0-100)
  153. *
  154. * Exit:        canceled    TRUE if the user clicked the Cancel button, FALSE otherwise
  155. *            returns        noErr, paramErr, or memFullErr
  156. }
  157. FUNCTION UpdateTranslationProgress(refNum: TranslationRefNum; percentDone: INTEGER; VAR canceled: BOOLEAN): OSErr;
  158.     {$IFC NOT GENERATINGCFM}
  159.     INLINE $7001, $ABFC;
  160.     {$ENDC}
  161. { ComponentMgr selectors for routines}
  162.  
  163. CONST
  164.     kTranslateGetFileTranslationList = 0;                        { component selectors}
  165.     kTranslateIdentifyFile        = 1;
  166.     kTranslateTranslateFile        = 2;
  167.     kTranslateGetTranslatedFilename = 3;
  168.     kTranslateGetScrapTranslationList = 10;                        { skip to scrap routines}
  169.     kTranslateIdentifyScrap        = 11;
  170.     kTranslateTranslateScrap    = 12;
  171.  
  172. { Routines to implment in a file translation extension}
  173. TYPE
  174.     DoGetFileTranslationListProcPtr = ProcPtr;  { FUNCTION (self: ComponentInstance; translationList: FileTranslationListHandle): ComponentResult; }
  175.  
  176.     DoIdentifyFileProcPtr = ProcPtr;  { FUNCTION (self: ComponentInstance; (CONST)VAR theDocument: FSSpec; VAR docType: FileType): ComponentResult; }
  177.  
  178.     DoTranslateFileProcPtr = ProcPtr;  { FUNCTION (self: ComponentInstance; refNum: TranslationRefNum; (CONST)VAR sourceDocument: FSSpec; srcType: FileType; srcTypeHint: LONGINT; (CONST)VAR dstDoc: FSSpec; dstType: FileType; dstTypeHint: LONGINT): ComponentResult; }
  179.  
  180.     DoGetTranslatedFilenameProcPtr = ProcPtr;  { FUNCTION (self: ComponentInstance; dstType: FileType; dstTypeHint: LONGINT; VAR theDocument: FSSpec): ComponentResult; }
  181.  
  182. { Routine to implement in a scrap translation extension}
  183.     DoGetScrapTranslationListProcPtr = ProcPtr;  { FUNCTION (self: ComponentInstance; list: ScrapTranslationListHandle): ComponentResult; }
  184.  
  185.     DoIdentifyScrapProcPtr = ProcPtr;  { FUNCTION (self: ComponentInstance; dataPtr: UNIV Ptr; dataLength: Size; VAR dataFormat: ScrapType): ComponentResult; }
  186.  
  187.     DoTranslateScrapProcPtr = ProcPtr;  { FUNCTION (self: ComponentInstance; refNum: TranslationRefNum; srcDataPtr: UNIV Ptr; srcDataLength: Size; srcType: ScrapType; srcTypeHint: LONGINT; dstData: Handle; dstType: ScrapType; dstTypeHint: LONGINT): ComponentResult; }
  188.  
  189.  
  190. {$ALIGN RESET}
  191. {$POP}
  192.  
  193. {$SETC UsingIncludes := TranslationExtensionsIncludes}
  194.  
  195. {$ENDC} {__TRANSLATIONEXTENSIONS__}
  196.  
  197. {$IFC NOT UsingIncludes}
  198.  END.
  199. {$ENDC}
  200.